home *** CD-ROM | disk | FTP | other *** search
/ The Original Shareware 1.1 / The Original Shareware (WeMake CDs)(Volume 1.1)(CDs, Inc)(1993).iso / 5 / chrpro3.zip / CFBUDGPC.CMD < prev    next >
OS/2 REXX Batch file  |  1991-01-21  |  5KB  |  174 lines

  1. * Program CFBUDGPC - Prints/Posts payments marked "posted" onto check forms.
  2. Use
  3. Select primary
  4. USE BDIRFILE index BDIRFILE
  5. GOTO 18
  6. Store !($(spact,31,1)) to plong
  7. SKIP
  8. Store val($(spact,26,2)) to chkdater
  9. Store val($(spact,29,2)) to chkdatec
  10. SKIP
  11. Store val($(spact,27,2)) to chklamtr
  12. Store val($(spact,30,2)) to chklamtc
  13. SKIP
  14. Store val($(spact,27,2)) to chksamtr
  15. Store val($(spact,30,2)) to chksamtc
  16. SKIP
  17. Store val($(spact,26,2)) to chknamer
  18. Store val($(spact,29,2)) to chknamec
  19. GOTO 25
  20. Store val($(spact,27,2)) to chkspacing
  21. Store d+':ACCOUNT'+DF  to MFILE
  22. USE &MFILE index &MFILE
  23. ?
  24. If msel='4'
  25.   Accept 'Now about to post payments for all marked amounts.  OK? ' to xx
  26. else
  27.  Accept 'Now about to print checks for all amounts marked to be posted. OK? ' ;
  28.  to XX
  29. endif
  30. If !(xx)<>'Y'
  31.   RETURN
  32. endif
  33. ?
  34. ? '         Expenditures Postings - ',curdate
  35. Store 'one  two  threefour five six  seveneightnine ' to snumber
  36. Store 'ten      eleven   twelve   thirteen fourteen fifteen  ' to snumteen
  37. Store snumteen+'sixteen  seventeeneighteen nineteen ' to snumteen
  38. Store 'twenty thirty forty  fifty  sixty  seventyeighty ninety ' to snumtens
  39. Store F to ENDOF
  40. If msel='3'
  41.   Set format to print
  42. endif
  43. Store $(account,1,2) to dept
  44. If dept<>'D1'
  45.   Accept 'Invalid ACCOUNTS file. No "D1" Department. Press <retn> ' to xx
  46.   RETURN
  47. endif
  48. Do while .not. ENDOF
  49.   Store 0.00 to newpaidt
  50.   Store $(account,1,2) to dept
  51.   Store # to curdept
  52.   SKIP
  53.   Store F to posted
  54.   Store 0 to ln
  55.   Do while account=DEPT .and. .not. ENDOF
  56.     If msel='3'.and. !(PP)='C'
  57.       Store T to posted
  58.       Replace PP with '*C'
  59.       @ chkdater+ln,chkdatec say curdate
  60.       If plong='Y'
  61.        Store chklamtc to chkc
  62.        Store str(newpaid,8,2) to newp
  63.        If $(newp,2,1)<>' '
  64.         If $(newp,1,1)<>' '
  65.           @ chklamtr+ln,chkc say $(newp,1,2)+' thousand '
  66.           store chkc+12 to chkc
  67.         else
  68.           Store trim($(snumber,val($(newp,2,1))*5-4,5)) to tnewp
  69.           @ chklamtr+ln,chkc say tnewp+' thousand '
  70.           Store len(tnewp)+10+chkc to chkc
  71.         endif
  72.       endif
  73.      * Now do hundreds
  74.       Store val($(newp,3,1)) to N
  75.       If N>0
  76.         Store trim($(snumber,val($(newp,3,1))*5-4,5)) to tnewp
  77.         @ chklamtr+ln,chkc say tnewp+' hundred '
  78.         Store len(tnewp)+9+chkc to chkc
  79.       endif
  80.       Store val($(newp,4,2)) to N
  81.       If N>0
  82.         If N<20
  83.          If N>9
  84.           Store trim($(snumteen,N*9-89,9))+' ' to tnewp
  85.          else
  86.           Store trim($(snumber,val($(newp,4,2))*5-4,5))+' ' to tnewp
  87.          endif
  88.         else
  89.          Store trim($(snumtens,val($(newp,4,1))*7-13,7))+' ' to tnewp
  90.          If val($(newp,5,1))>0
  91.            Store tnewp+trim($(snumber,val($(newp,5,1))*5-4,5))+' ' to tnewp
  92.          endif
  93.         endif
  94.         @ chklamtr+ln,chkc say tnewp
  95.         Store len(tnewp)+chkc to chkc
  96.       endif
  97.       If chkc<>chklamtc
  98.         @ chklamtr+ln,chkc say 'and '
  99.         Store chkc+4 to chkc
  100.       endif
  101.       If val($(newp,7,2))>0
  102.         @ chklamtr+ln,chkc say $(newp,7,2)+'/100'
  103.       else
  104.         @ chklamtr+ln,chkc say 'no/100'
  105.       endif
  106.      endif
  107.      If chkc+6<chksamtc
  108.        @ chksamtr+ln,chksamtc say newpaid
  109.      else
  110.        ? 'Error in long amount run-over -  Only the long amount is printed.'
  111.      endif
  112.      @ chknamer+ln,chknamec say $(account,5,21)
  113.      If address<>'    '
  114.        @ chknamer+ln+1,chknamec say address
  115.        @ chknamer+ln+2,chknamec say city:state
  116.      endif
  117.      Store chkspacing+ln to ln
  118.      If ln+chkspacing>66
  119.        EJECT
  120.        Store 0 to ln
  121.      endif
  122.      Replace PP with '*C'
  123.      REPLACE NEWPDATE WITH DATE()
  124.      Store newpaidt+newpaid to newpaidt
  125.      ? ACCOUNT,NEWPAID
  126.     ENDIF     * !(PP)='C' .and.MSEL='3'
  127.     If msel='4'.and.!(PP)='P'
  128.      Replace PP with '*P'
  129.      Replace newpdate with date()
  130.      Store T to posted
  131.      Store newpaidt+newpaid to newpaidt
  132.     ? account,newpaid
  133.     endif
  134.     SKIP
  135.     If EOF .or. account<>'D'
  136.       Store T to ENDOF
  137.     endif
  138.   enddo
  139. If posted
  140.     Store # to newdept
  141.     GOTO curdept
  142.     replace newowed with newowed+newpaidt
  143.     Replace newpaid with newpaid-newpaidt
  144.     GOTO newdept
  145. endif
  146. enddo
  147. If msel='3'
  148.   EJECT
  149.   Set format to screen
  150. endif
  151. USE
  152. Release chkdater,chkdatec,chknamer,chknamec,snumber,snumteen,snumtens,dept
  153. Release chksamtr,chksamtc,chklamtr,chklamtc,curdept,newpaidt,posted,chkc
  154. Release newp,tnewp,newpaidt,newdept,curdept,plong,chkspacing,endof,acctbal,ln
  155. Accept 'All postings are complete. Press <RETURN> ' to N
  156. RETURN
  157. $(spact,27,2)) to chkspacing
  158. Store d+':ACCOUNT'+DF  to MFILE
  159. USE &MFILE index &MFILE
  160. ?
  161. If msel='4'
  162.   Accept 'Now about to post payments for all marked amounts.  OK? ' to xx
  163. else
  164.  Accept 'Now about to print checks for all amounts marked to be posted. OK? ' ;
  165.  to XX
  166. endif
  167. If !(xx)<>'Y'
  168.   RETURN
  169. endif
  170. ?
  171. ? '         Expenditures Postings - ',curdate
  172. Store 'one  two  threefour five six  seveneightnine ' to snumber
  173. Store 'ten      eleven   twelve   thirteen fourteen fifteen  ' to snumteen
  174. St